package net.lainiao.manager.control;

import net.lainiao.reptile.ReptileServiceControl;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import javax.lang.model.element.Name;

/**
 * Created by Administrator on 2017/1/9.
 */
@Controller
@RequestMapping(value = "/net.lainiao.zhihu.service")
public class ServiceControl {
    private String baseDir = "/net.lainiao.zhihu.service/";
    @Resource
    ReptileServiceControl reptileServiceControl;
    @RequestMapping(value = "index")
    public String index(ModelMap modelMap) {
        return baseDir + "index";
    }

    @RequestMapping(value = "/startReptile")
    @ResponseBody
    public String startReptile() {
        return reptileServiceControl.start("爬虫");
    }

    @RequestMapping(value = "/endReptile")
    @ResponseBody
    public String endReptile() {
        return reptileServiceControl.stop("爬虫");
    }

    @RequestMapping(value = "/startIndex")
    @ResponseBody
    public String startIndex() {
        return reptileServiceControl.start("索引");
    }

    @RequestMapping(value = "/endIndex")
    @ResponseBody
    public String endIndex() {
        return reptileServiceControl.stop("索引");
    }
}
